# Contributor: Jake Buchholz Göktürk <tomalok@gmail.com>
# Maintainer: Jake Buchholz Göktürk <tomalok@gmail.com>

pkgname=runc
pkgdesc="CLI tool for spawning and running containers according to the OCI specification"
url="https://www.opencontainers.org"
_commit=6724737f999df9ee0d8ca5c6d7b81f97adc34374
pkgver=1.1.3
pkgrel=0
arch="all"
license="Apache-2.0"
makedepends="bash go go-md2man libseccomp-dev libtool"
subpackages="$pkgname-doc"
source="https://github.com/opencontainers/runc/archive/v$pkgver/runc-$pkgver.tar.gz"
builddir="$srcdir/src/github.com/opencontainers/runc"
options="!check"

# secfixes:
#   1.1.2-r0:
#     - CVE-2022-29162
#   1.0.3-r0:
#     - CVE-2021-43784
#   1.0.0_rc95-r0:
#     - CVE-2021-30465
#   1.0.0_rc10-r0:
#     - CVE-2019-19921
#   1.0.0_rc9-r0:
#     - CVE-2019-16884
#   1.0.0_rc7-r0:
#     - CVE-2019-5736

build() {
	cd "$srcdir"
	export GOPATH="$PWD"
	mkdir -p "$(dirname "$builddir")"
	ln -s "$PWD/$pkgname-$pkgver" "$builddir"
	cd "$builddir"
	make COMMIT="$_commit" EXTRA_LDFLAGS="-w -s"
	make man
}

package() {
	install -Dsm755 "$builddir"/runc "$pkgdir"/usr/bin/runc
	install -d "$pkgdir"/usr/share/man/man8/
	install -Dm644 "$builddir"/man/man8/* "$pkgdir"/usr/share/man/man8/
}

sha512sums="
27fce2569d0dc710a0f90095957be30c29da24ce1d2b8e115b9dc11d36f5226d98c4b2d8b92ecfa7581eade90bc51c5d9bccaf15fcb2542dafebe4fabc6e1cd9  runc-1.1.3.tar.gz
"
